package web.handler;

import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import web.common.Result;
import web.exception.UrlException;

//@ControllerAdvice
public class FilterExceptHandler {
    //	指定处理的异常是什么
//    @ExceptionHandler(UrlException.class)
//    public Result showExceptionMessege(UrlException e) {
//        System.out.println("--------------------------------------------");
//        return  Result.fail(e.getMessasge());
//    }


//    @ResponseStatus(HttpStatus.UNAUTHORIZED)
//    @ExceptionHandler(UnauthenticatedException.class)
//    public Result handler(UnauthenticatedException e) {
//        ByteArrayOutputStream baos = new ByteArrayOutputStream();
//        e.printStackTrace(new PrintStream(baos));
//        String exception = baos.toString();
//        log.error(exception);
//        return Result.fail("没有登录");
//    }
}
